﻿namespace System.Numerics
{
	using System.Text;

	/// <summary>
	/// Internal implementation details.
	/// </summary>
	internal static class Internals
	{
		/// <summary>
		/// Formats the specified values with the specified format string and format provider, separated with spaces.
		/// </summary>
		/// <param name="format">Format string.</param>
		/// <param name="formatProvider">Format provider.</param>
		/// <param name="values">An array of values to format.</param>
		/// <returns>The specified values formatted with the <paramref name="format"/> and the <paramref name="formatProvider"/>.</returns>
		public static string Format(string format, IFormatProvider formatProvider, params Single[] values)
		{
			var s = new StringBuilder();

			for (int i = 0; i < values.Length; i++)
			{
				if (i > 0)
				{
					s.Append(' ');
				}

				s.Append(values[i].ToString(format, formatProvider));
			}

			return s.ToString();
		}

		/// <summary>
		/// The smallest positive floating point value used in the calculations.
		/// </summary>
		public const Single Epsilon = 0.0001f;

		/// <summary>
		/// Whitespace characters.
		/// </summary>
		public static readonly char[] Whitespace = { ' ', '\t', '\r', '\n' };
	}
}
